<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ page import="sfmc.biz.vo.Sfmc_OLD_FILE_LIST"%>
<%
String oldFileList = (String)request.getAttribute("oldFileList");
Sfmc_OLD_FILE_LIST oldFiledata = (Sfmc_OLD_FILE_LIST)request.getAttribute("sfmc_OLD_FILE_LIST");
String waveUrl_old = "http://127.0.0.1:8080/wave/";
%>

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=IE8" />
<meta http-equiv="Cache-Control" content="No-Cache" />
<meta http-equiv="Pragma" content="No-Cache" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>고객 등록</title>
<link rel="stylesheet" type="text/css" href="/resources/theme/metro-blue/easyui.css" />
<link rel="stylesheet" type="text/css" href="/resources/theme/icon.css" />
<link rel="stylesheet" type="text/css" href="/resources/css/ui_custom.css" />
<link rel="stylesheet" type="text/css" href="/resources/css/design.css" />
<link rel="stylesheet" type="text/css" href="/resources/css/form.css" />
<!--[if lt IE 9]>
	<script type="text/javascript" src="/resources/js/html5.js" /></script>
<![endif]-->
<script type="text/javascript" src="/resources/js/jquery-1.9.1.js"></script>
<script type="text/javascript" src="/resources/js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="/resources/js/jquery.easyui.min.js"></script>
<script type="text/javascript" src="/resources/js/jquery.jclock.js"></script>
<script type="text/javascript" src="/resources/js/common.js" /></script>
<script type="text/javascript" src="/resources/js/is.validate.js" /></script>

<script type="text/javascript" language="javascript">
function getList(isClear){
	
	if(isClear){
		document.form.pageNo.value = 1;
		document.form.pageSize.value = 20;
	}
	
	document.form.target = "_self";
	document.form.action="/old_file_list.do";
	document.form.submit();
}

function getNewList(){
	document.location.href = "/main.do";
}

function openMenu(name){
	
	var url = "";
	var opt = "scrollbars=no, resizable=no, ";
	var width = 0;
	var height = 0;
	
	switch(name){
	
	case "emp" : url = "/emp_list.do"; width=330; height=500;
		break;
	case "customer" : url = "/customer_list.do"; width=760; height=788;
		break;
	case "holiday" : url = "/holiday_list.do"; width=450; height=610;
		break;
	case "workTime" : url = "/option_list.do"; width=330; height=330;
		break;
	case "yearStat" : url = "/yearlyStauts_list.do"; width=850; height=600;
		break;
	case "monthStat" : url = "/monthlyStauts_list.do"; width=850; height=600;
		break;
	case "weekStat" : url = "/weeklyStatus_list.do"; width=850; height=600;
		break;
	case "dayStat" : url = "/daillyStauts_list.do"; width=850; height=600;
		break;
	case "custStat" : url = "/custStatus_list.do"; width=800; height=642;
		break;
	case "empStat" : url = "/empStatus_list.do"; width=1200; height=642;
		break;
	}
	
	var _win = window.open(url,name,opt+"width="+width+",height="+height+",left="+(screen.availWidth-width)/2 + ",top="+(screen.availHeight-height)/2);
	_win.focus();
}
</script>
</head>
	<body class="easyui-layout">
	<form method="POST" name="form">
	<input type="hidden" name="pageNo" value="<%=oldFiledata.getPageNo()%>">
	<input type="hidden" name="pageSize" value="<%=oldFiledata.getPageSize()%>">
	<div data-options="region:'north',border:false" class="layout_north">

		<div class="easyui-panel" data-options="fit:true" style="overflow:hidden;position:relative">
			
			<div class="wrap_gnb_logo">
				<div class="gnb_logo">
					<img src="/resources/img/logo_header.png" /><span>재활용관리시스템</span>
				</div>
			</div>
			<div class="datagrid-header gnb_menu">
		        <a href="javascript:void(0)" class="easyui-menubutton" data-options="menu:'#mm1'">등록</a>
		        <a href="javascript:void(0)" class="easyui-menubutton" data-options="menu:'#mm2'">통계</a>
			</div>
		    <div id="mm1">
		        <div onClick="javascript:openMenu('emp');">담당자 등록</div>
		        <div onClick="javascript:openMenu('customer');" id="mm1_02">고객 등록</div>
		        <div onClick="javascript:openMenu('holiday');">휴일 등록</div>
		        <div onClick="javascript:openMenu('workTime');">근무시간</div>
		    </div>
		    <div id="mm2">
		        <div onClick="javascript:openMenu('yearStat');">년별 통계</div>
		        <div onClick="javascript:openMenu('monthStat');">월별 통계</div>
		        <div onClick="javascript:openMenu('weekStat');">주간별 통계</div>
		        <div onClick="javascript:openMenu('dayStat');">일별 통계</div>
		        <div class="menu-sep"></div>
		        <div onClick="javascript:openMenu('custStat');">업체별 주문현황</div>
		        <div onClick="javascript:openMenu('empStat');">사용자별 확인현황</div>
		    </div>
		</div>
	</div>

	<div data-options="region:'center',border:false">
	
		<div class="easyui-layout" data-options="fit:true">
			<div data-options="region:'center',border:false">
				<div class="easyui-panel bb0" data-options="iconCls:'icon-head01',border:false,fit:true,title:'Callback'">
					<table id="grid_callback" class="easyui-datagrid"></table>
							
					<div id="tb_callback" class="datagrid-toolbar wrap_tbl_toolbar">	
						<table class="tbl_inner">	
							<colgroup>
								<col width="65px">
								<col width="220px">
								<col width="60px">
								<col width="75px">
								<col width="65px">
								<col width="270px">
								<col width="55px">
								<col width="160px">
							</colgroup>
							<tr>
								<th>조회기간</th>
								<td>
								    <input name="searchFromDate" class="easyui-datebox" value="<%=oldFiledata.getSearchFromDate()%>" data-options="formatter:myformatter"></input> ~
								    <input name="searchToDate" class="easyui-datebox" value="<%=oldFiledata.getSearchToDate()%>" data-options="formatter:myformatter,parser:myparser"></input>
								</td>
								<th>확인여부</th>
								<td>
									<select name="status">
										<option value="" <%=("".equals(oldFiledata.getStatus())) ? "selected" : "" %>>전체</option>
										<option value="1" <%=("1".equals(oldFiledata.getStatus())) ? "selected" : "" %>>확인</option>
										<option value="0" <%=("0".equals(oldFiledata.getStatus())) ? "selected" : "" %>>미확인</option>
									</select>
								</td>
								<th>채널설정</th>
								<td>
									<input name="groupNo" type="radio" value="" <%=("".equals(oldFiledata.getGroupNo())) ? "checked='true'" : "" %>>전체&nbsp;&nbsp;
									<input name="groupNo" type="radio" value="1" <%=("1".equals(oldFiledata.getGroupNo())) ? "checked='true'" : "" %>>1ch&nbsp;&nbsp;
									<input name="groupNo" type="radio" value="2" <%=("2".equals(oldFiledata.getGroupNo())) ? "checked='true'" : "" %>>2ch&nbsp;&nbsp;
									<input name="groupNo" type="radio" value="3" <%=("3".equals(oldFiledata.getGroupNo())) ? "checked='true'" : "" %>>3ch&nbsp;&nbsp;
									<input name="groupNo" type="radio" value="4" <%=("4".equals(oldFiledata.getGroupNo())) ? "checked='true'" : "" %>>4ch
								</td>
								<th>서버설정</th>
								<td>
									<input name="server" type="radio" value="1" onclick="getNewList();">신서버&nbsp;&nbsp;
									<input name="server" type="radio" value="2" checked=true>구서버&nbsp;&nbsp;
								</td>
								<td><a href="javascript:getList(true);" class="easyui-linkbutton" data-options="iconCls:'icon-search'">조회</a>
								<a href="javascript:getExcel();" class="easyui-linkbutton" data-options="iconCls:'icon-excel'">엑셀저장</a></td>
							</tr>
						</table>
					</div>
				</div>
			</div>
			<div data-options="region:'south',border:false">
				<div  class="easyui-layout" data-options="fit:true">
				
					<div data-options="region:'north',border:false">
						<div id="pp" class="easyui-pagination">
						</div>
					</div>
					
					<div data-options="region:'center',border:false">
						<div class="easyui-panel combobox-item-selected padding5" data-options="fit:true">
							<table class="tbl_inner">	
								<colgroup>
									<col>
									<col width="90px">
									<col>
								</colgroup>
								<tr>
									<th></th>
									<td></td>
									<td></td>
								</tr>
							</table>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>

	<div data-options="region:'south',border:false" class="layout_south">
		Copyright 2013 Suwon City Facilities Management Corporation.
		<p class="clock">	
			<span id="date"></span>
			<span id="clock"></span>
		</p>
	</div>
	</form>
</body>

<script type="text/javascript">
//캘린더
function myformatter(date){
    var y = date.getFullYear();
    var m = date.getMonth()+1;
    var d = date.getDate();
    return y+'-'+(m<10?('0'+m):m)+'-'+(d<10?('0'+d):d);
}
function myparser(s){
    if (!s) return new Date();
    var ss = (s.split('-'));
    var y = parseInt(ss[0],10);
    var m = parseInt(ss[1],10);
    var d = parseInt(ss[2],10);
    if (!isNaN(y) && !isNaN(m) && !isNaN(d)){
        return new Date(y,m-1,d);
    } else {
        return new Date();
    }
}
//그리드
$('#grid_callback').datagrid({
	rownumbers:true,
    fitColumns: true,
    singleSelect: true,
    fit: true,
    striped: true,
    toolbar:'#tb_callback',
    //pagination: true,
    nowrap: true,
    data:<%=oldFileList%>,
    columns:[[
        {field:'num',title:'',fixed:true,width:20,checkbox:true},
        {field:'status',title:'상 태',fixed:true,width:60,align:'center'},
      	{field:'recDate',title:'기 록 일',fixed:true,width:90,align:'center'},
      	{field:'recTime',title:'기 록 시 간',fixed:true,width:80,align:'center'},
      	{field:'cid',title:'C I D',fixed:true,width:120,align:'center'},
      	{field:'telNo',title:'전 화 번 호',fixed:true,width:100,align:'center'},
      	{field:'groupNo',title:'그 룹 번 호',fixed:true,width:70,align:'center'},
      	{field:'reason',title:'reason',fixed:true,width:200,align:'center'},
      	{field:'fileName',title:'파 일 명',fixed:true,width:220,align:'center'},
      	{field:'checkDate',title:'검 토 일',fixed:true,width:90,align:'center'},
      	{field:'checkTime',title:'검 토 시 간',fixed:true,width:80,align:'center'}
    ]],

	onDblClickRow: function(rowIndex, row){
		window.location.href = "<%=waveUrl_old%>"+row.fileName;
	}
});
$('#pp').pagination({
    total:<%=oldFiledata.getTotalCnt()%>,
    pageSize:<%=oldFiledata.getPageSize()%>,
    pageNumber:<%=oldFiledata.getPageNo()%>,
    pageList:[20,30,50]
});
$('#pp').pagination({
	onSelectPage:function(pageNumber, pageSize){
		$(this).pagination('loading');
		document.form.pageNo.value = pageNumber;
		document.form.pageSize.value = pageSize;
		$(this).pagination('loaded');
		getList();
	}
});
function cellStyler(index,row){
    if (row.num < 2){
        return '<span class="grid_error"></span>';
    }
}
function detailLink(val,rec){
	return '<a href="${ctx}/rvhistory/detail">'+val+'</a>';
}
</script>
</html>